<?
if (!defined ('L_MOD')) {die("<h3>You can`t access this file...</h3>");}

if(isset($sid) && is_numeric($sid) && $sid!='')
{
	$query = mysql_query("SELECT links . * , category.mod_id AS cat_id, 
		category.mod_category AS category_name, 
		category.mod_18 AS mod_18, 
		user.user_name 
		FROM ${wcpref}".$nma." links 
		INNER JOIN ${wcpref}".$nma."_category category ON links.mod_cat_id = category.mod_id 
		INNER JOIN ${wcpref}user user ON links.mod_user_id=user.id 
	WHERE links.mod_id = '".$sid."'");

	if (mysql_num_rows($query)!=1)
	{
		print '<br><br><center><b><font color="#FF0000">'._ERROR_.'</font> '._ERRORSIDSITE_.'</b></center>';
		echo "<meta http-equiv='refresh' content='2; url=/index.php?nma=".$nma."&fla=index'>";
	}else
	{
		extract(mysql_fetch_array($query));
	
		if($mod_18==1 && $wccat_allow18plus==0)
		{
			print '<br><br><center><b><font color="#FF0000">'._ERROR_.'</font> '._ERRORSIDSITE_.'</b></center>';
			echo "<meta http-equiv='refresh' content='2; url=/index.php?nma=".$nma."&fla=category&cid=".$cat_id."'>";
		}else
		{
			if ($mod_ban=='0')
			{
				if ($mod_full=='')
				{
					print '<br><br><center><b><font color="#FF0000">'._ERROR_.'</font> '._ERRORSIDFULL_.'</b></center>';
					echo "<meta http-equiv='refresh' content='2; url=/index.php?nma=".$nma."&fla=category&cid=".$cat_id."'>";
				}else
				{
					if($mod_block==1)
					{
						print '<br><br><center><b><font color="#FF0000">'._ERROR_.'</font> '._ERRORSIDBLOCK_.'</b></center>';
						echo "<meta http-equiv='refresh' content='2; url=/index.php?nma=".$nma."&fla=category&cid=".$cat_id."'>";
					}else
					{
						if($mod_18==1)
							$add='<font color="#FF0000" size="-3"><sup>18+</sup></font>';
						else 
							$add='';
						print '<h2><a href="?nma='.$nma.'&fla=category&cid='.$cat_id.'">'.$category_name .'</a>: <a href="http://'.$mod_url .'" target="_blank">'.$mod_name.'</a>'.$add.'</h2><br>';
						$dat=date('d.m.Y', strtotime($mod_dat));
						if ($mod_wcps==1)
							$wcpslink='<a href="http://wcps.ru" target="_blank" title="'._UNDERWCPS_.'"><img src="/images/'.$nma.'/wcpsimg.gif" border="0"></a>';
						if($mod_user_id>1)
							$userlink='<a href="?nma=user&fla=view&ids='.$user_name.'">'.$user_name.'</a>';
						elseif($mod_user_id==-1)
							$userlink=_GUEST_;
							
						if ($mod_map==1)
						{
							$mapRow='<tr>
								<td colspan="3" align="center" valign="top">
									<a href="index.php?nma='.$nma.'&fla=maps&item=wcpssite&sid='.$sid.'">'._MAPSSITE_.'</a>
								</td>
							</tr>';
						}else
							$mapRow='';
						
						print'<table align="center" width="98%" cellspacing="1" cellpadding="1" border="0">
							<tr>
								<td align="center"><b>'._WHOADD_.': '.$userlink.'</b></td>
								<td align="center"><b>'._ADDED_.': '.$dat.'</b></td>
								<td align="center">'.$wcpslink.'</td>
							</tr>
							'.$mapRow.'
							<tr>
								<td colspan="3"><br><p align="justify">'.$mod_full .'</p></td>
							</tr>
						</table>';
						print '<br><table>
						<tr>
							<td align="left">
								<a href="?nma='.$nma.'&fla=index">'._TOCATEGORY_.'</a>&nbsp;&nbsp;
							</td>
						</tr>
					</table>';
						print '<br><br><table align="center" border="0" cellpadding="1" cellspacing="1">
							<tr>';
								if($_SESSION['auth']==1)
								{
									print'<td align="center">
										<a href="?nma='.$nma.'&fla=mysites">'._MYSITES_.'</a>&nbsp;&nbsp;
									</td>';
								}
								print'<td align="center">
									&nbsp;&nbsp;<a href="'.$wccat_service_url.'/index.php?nma=wccat&fla=addwcsite&cid='.$cat_id.'">'._ADDWCPSSITE_.'</a>&nbsp;&nbsp;
								</td>
								<td align="center">';
									if ($wccat_allowadd==1)
										print'&nbsp;&nbsp;<a href="?nma='.$nma.'&fla=addsite&cid='.$cat_id.'">'._ADDOTHERSITE_.'</a>';
								print'</td>
							</tr>
						</table>';
					}
				}
			}else
			{
				print '<br><br><center><b><font color="#FF0000">'._ERROR_.'</font> '._ERRORBANSITE_.'</b></center>';
				echo "<meta http-equiv='refresh' content='2; url=/index.php?nma=".$nma."&fla=category&cid=".$cat_id."'>";
			}
		}
	}
}else
{
	print '<br><br><center><b><font color="#FF0000">'._ERROR_.'</font> '._ERRORSIDSITE_.'</b></center>';
	echo "<meta http-equiv='refresh' content='2; url=/index.php?nma=".$nma."&fla=index'>";
}
?>